<template>
	<view class="container">
		<view class="label">行程介绍</view>
		<scroll-view class="scroll" scroll-y @scrolltolower="loadMore">
			<view class="list">
				<view class="list-item flex-row-center" v-for="(item,index) in list" :key="index"
					>
					<!-- @click="chooseIntroduce(item.product.id)" -->
					<image :src="item.product.picture" mode=""></image>
					<text :class="introduce.indexOf(item.product.id) > -1?'active':''">{{item.product.title}}</text>
				</view>
			</view>
		</scroll-view>

	</view>
</template>

<script>
	export default {
		props: {
			
		},
		data() {
			return {
				list: [],
				page: 1,
				pageSize: 10,
				introduce:[]
			};
		},
		mounted() {
			this.getList()
		},
		methods: {
			//没有分页
			async getList(limit) {
				uni.showLoading({
					title: '加载中'
				})
				let res = await this.$api.carList({
					limit: limit ? limit : this.page * this.pageSize
				})
				if (res.data.status) {
					uni.hideLoading();
					this.list = res.data.data
				}
				this.$emit("getIntroduceList", this.list)
			},
			loadMore() {
				console.log(111)
				if (this.list.length <= this.page * this.pageSize) return
				this.page++
				this.getList()
			},
			chooseIntroduce(id) {
				this.$emit("addIntroduce", id)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		height: 100%;
	}

	.label {
		line-height: $text-size;
		font-size: $text-size;
		color: #6F6F6F;
		margin-bottom: 40rpx;
	}

	.scroll {
		flex: 1;
		height: 100%;
	}

	.list {
		.list-item {
			padding-bottom: 30rpx;
			border-bottom: 2rpx solid #EFEFEF;

			image {
				width: 140rpx;
				height: 100rpx;
				border-radius: 20rpx;
				margin-right: 30rpx;
			}

			text {
				width: 414rpx;
				line-height: 32rpx;
				font-size: 32rpx;
				font-weight: $Semibold;
				color: #525252;
			}

			.active {
				color: #6880FF;
			}
		}
	}
</style>